// 引入项目中全部的全局组件
import SvgIcon from './SvgIcon/index.vue'
import Pagination from './Pagination/index.vue'
import Category from './Category/index.vue'

import * as ElementPlusIconVue from '@element-plus/icons-vue'

//全局对象
const allGlobalComponent = { SvgIcon, Pagination, Category }

// 对外暴露插件对象
export default {
  // 务必叫做install 放法
  install(app: any) {
    Object.keys(allGlobalComponent).forEach((key) => {
      // 注册为全局组件
      app.component(key, allGlobalComponent[key])
    })
    // 将elemetn-plus 提供得图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconVue)) {
      app.component(key, component)
    }
  },
}
